package ebedynky.controllers;

import ebedynky.beans.User;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 *
 * @author Jan Remes
 */
@Controller
public class LoginController {

    /**
     * Returns the location of the login page.
     * @param model data holder for this view
     * @return string representing page location
     */
    @RequestMapping(value = "/login", method = RequestMethod.GET)
    public String spring_security_redirect(Model model) {
        return "/login/login";
    }

    /**
     * Returns the location of the login page with errors as parameters.
     * @param model data holder for this view
     * @return string representing page location
     */
    @RequestMapping(value = "/login", params = "login_error=1")
    public String loadErrorLogin(Model model) {
        return "/login/login.jsp?login_error=1";
    }
}
